using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using JGSY.CMS.LowCode.Platform.Infrastructure.Extensions;
using JGSY.CMS.LowCode.Platform.Infrastructure.ServiceCollectionExtensions;

namespace JGSY.CMS.LowCode.Platform.Infrastructure.Configuration.ServiceModules.Modules
{
    /// <summary>
    /// 系统优化服务模块
    /// 包含系统级别的优化配置和服务
    /// </summary>
    public class SystemOptimizationModule : IServiceModule
    {
        public string ModuleName => "系统优化服务";
        public int Priority => 8;
        public bool LoadInFastMode => false; // 快速模式下不加载系统优化
        public ModulePermission RequiredPermission => ModulePermission.SystemOptimizationServices;
        public bool IsCriticalModule => false; // 非关键模块

        public void ConfigureServices(IServiceCollection services, IConfiguration configuration)
        {
            // 完整系统优化功能
            services.AddSystemOptimizations(configuration);
        }

        public void ConfigureMinimalServices(IServiceCollection services, IConfiguration configuration)
        {
            // 精简系统优化功能 - 无特殊配置（系统优化在快速模式下不需要）
            // 留空，系统优化在精简模式下不启用
        }

        public bool ValidateConfiguration(IConfiguration configuration)
        {
            // 系统优化模块可以使用默认配置
            return true;
        }
    }
}
